import { fileURLToPath, URL } from 'node:url';
import { defineConfig, mergeConfig } from 'vite';

import baseConfig from '../core/vite.config.base';

const currentConfig = defineConfig({
  root: fileURLToPath(new URL('./', import.meta.url)),
  base: '/',
  server: {
    port: 7100,
    origin: 'http://local-cns.test.ctyun.cn:7100',
  },
  resolve: {
    alias: {
      '@main': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  css: {
    preprocessorOptions: {
      scss: { additionalData: '@use "@main/styles/element.scss" as *;' },
    },
  },
});

export default mergeConfig(baseConfig, currentConfig);
